import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { JVxeTypes, JVxeColumn } from '/@/components/jeecg/JVxeTable/types';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '*机构编码',
    align: 'center',
    sorter: true,
    dataIndex: 'orgCode',
  },
  {
    title: '*机构级别',
    align: 'center',
    dataIndex: 'orgLevel_dictText',
  },
  {
    title: '上级机构',
    align: 'center',
    dataIndex: 'parentOrg_dictText',
  },
  {
    title: '*机构全称',
    align: 'center',
    dataIndex: 'fullName',
  },
  {
    title: '机构简称',
    align: 'center',
    dataIndex: 'name',
  },
  {
    title: '*机构类型',
    align: 'center',
    dataIndex: 'orgType_dictText',
  },
  {
    title: '*社会统一信用代码',
    align: 'center',
    dataIndex: 'socialCredit',
  },
  {
    title: '*国家',
    align: 'center',
    dataIndex: 'country',
  },
  {
    title: '*法定代表人',
    align: 'center',
    dataIndex: 'contacter',
  },
  {
    title: '启用状态',
    align: 'center',
    dataIndex: 'upStatus_dictText',
  },
  {
    title: '启用进度',
    align: 'center',
    dataIndex: 'upProgress',
  },
  {
    title: '同步状态',
    align: 'center',
    dataIndex: 'synStatus_dictText',
  },
  {
    title: '同步进度',
    align: 'center',
    dataIndex: 'synProgress',
  },
  {
    title: '数据状态',
    align: 'center',
    dataIndex: 'dataStatus_dictText',
  },
];

//子表表格配置
export const orgBankColumns: JVxeColumn[] = [
  {
    title: '支行名称',
    key: 'bankName',
    type: JVxeTypes.popup,
    popupCode: 'bank_report',
    fieldConfig: [
      { source: 'bank_name', target: 'bankName' },
      { source: 'country', target: 'country' },
      { source: 'bank_type', target: 'bankType' },
      { source: 'bank_code', target: 'bankCode' },
      { source: 'bank_area', target: 'bankArea' },
    ],

    width: '200px',
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '银行账号(卡号)',
    key: 'accountNumber',
    type: JVxeTypes.input,
    width: '200px',
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '开户名称',
    key: 'accountName',
    type: JVxeTypes.input,
    width: '200px',
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '国家',
    key: 'country',
    type: JVxeTypes.select,
    options: [],
    dictCode: 'sys_province,name,id2',
    disabled: true,
    width: '200px',
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '银行名称',
    key: 'bankType',
    type: JVxeTypes.select,
    options: [],
    dictCode: 'bank_type,bank_type_name,bank_type',
    disabled: true,
    width: '200px',
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '联行号',
    key: 'bankCode',
    type: JVxeTypes.input,
    disabled: true,
    width: '200px',
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '所在地区',
    key: 'bankArea',
    type: JVxeTypes.select,
    options: [],
    dictCode: 'bank_area,bank_area_name,bank_area',
    disabled: true,
    width: '200px',
    placeholder: '请输入${title}',
    defaultValue: '',
  },
];

// 高级查询数据
export const superQuerySchema = {
  orgCode: { title: '*机构编码', order: 0, view: 'text', type: 'string' },
  orgLevel: { title: '*机构级别', order: 1, view: 'list', type: 'string', dictCode: 'org_level' },
  parentOrg: {
    title: '上级机构',
    order: 2,
    view: 'sel_search',
    type: 'string',
    dictTable: "org_main where data_status='ysx'",
    dictCode: 'org_code',
    dictText: 'full_name',
  },
  fullName: { title: '*机构全称', order: 3, view: 'text', type: 'string' },
  name: { title: '机构简称', order: 4, view: 'text', type: 'string' },
  orgType: { title: '*机构类型', order: 5, view: 'list', type: 'string', dictCode: 'org_type' },
  socialCredit: { title: '*社会统一信用代码', order: 6, view: 'text', type: 'string' },
  country: { title: '*国家', order: 8, view: 'link_down', type: 'string' },
  contacter: { title: '*法定代表人', order: 12, view: 'text', type: 'string' },
  upStatus: { title: '启用状态', order: 20, view: 'list', type: 'string', dictCode: 'up_status' },
  upProgress: { title: '启用进度', order: 21, view: 'text', type: 'string' },
  synStatus: { title: '同步状态', order: 22, view: 'list', type: 'string', dictCode: 'syn_status' },
  synProgress: { title: '同步进度', order: 23, view: 'text', type: 'string' },
  dataStatus: { title: '数据状态', order: 24, view: 'list', type: 'string', dictCode: 'data_status' },
  //子表高级查询
  orgBank: {
    title: '机构-供应商银行信息',
    view: 'table',
    fields: {
      bankName: {
        title: '支行名称',
        order: 0,
        view: 'popup',
        type: 'string',
        code: 'bank_report',
        orgFields: 'bank_name',
        destFields: 'bankName',
        popupMulti: false,
      },
      accountNumber: { title: '银行账号(卡号)', order: 1, view: 'text', type: 'string' },
      accountName: { title: '开户名称', order: 2, view: 'text', type: 'string' },
      country: { title: '国家', order: 3, view: 'radio', type: 'string', dictTable: 'sys_province', dictCode: 'id2', dictText: 'name' },
      bankType: {
        title: '银行名称',
        order: 4,
        view: 'radio',
        type: 'string',
        dictTable: 'bank_type',
        dictCode: 'bank_type',
        dictText: 'bank_type_name',
      },
      bankCode: { title: '联行号', order: 5, view: 'text', type: 'string' },
      bankArea: {
        title: '所在地区',
        order: 6,
        view: 'radio',
        type: 'string',
        dictTable: 'bank_area',
        dictCode: 'bank_area',
        dictText: 'bank_area_name',
      },
    },
  },
};
